<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <script src="{$Think.config.httpFlag}{$Think.config.google_map_url}" async="async"></script>
</head>

<body>
    <div class="layui-fluid main">
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
            <form class="layui-form serch" action="/admin/poi/airportadmin.shtml" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <input type="text" name="cityname" lay-verify="title" autocomplete="off" placeholder="请输入城市名称" class="layui-input layui-btn-sm">
                    </div>
                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                </div>
            </form>
        </fieldset>
        <div style="display: inline-block;width: 30%">
            <table class="layui-table"  lay-even="" lay-skin="line" >
                <colgroup>
                    <col width="100">
                    <col width="400">
                    <col width="300">
                    <col width="200">
                </colgroup>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>城市</th>
                    <th>机场数量</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>

                {volist name="city" id="vo"}
                <tr class="seemap" codeid="{$vo.id}">

                    <td>{$vo.id}</td>
                    <td ><strong >{$vo.name}</strong><br/>{$vo.eng_name}</td>
                    <td>{$vo.poinum}</td>
                    <td class="operation-menu">
                        <a href="{:url('admin/poi/airport',['id'=>$vo.id])}" class="layui-btn layui-btn-xs" style="margin-left: 0;font-size:12px;">查看机场</a>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
        </div>


        <div class="right75" style="width: 65%;margin: 10px 0">
            <div style="margin: 10px 0"><h2 id="poiname">{if $name}{$name}{/if}</h2></div>
            <div style="margin: 10px  0" id="description">
                {if $description}{$description}{/if}
            </div>

            <hr>
            <div id="map" style="height: 500px;width: 100%">

            </div>
            <hr>
            <div style="margin: 10px  0" id="thumb">

                {volist name="$thumb" id="vo"}
                {if !empty($vo)}
                <span class="uploadimgbox"><img class="layui-upload-img" src="{$vo}"></span>
                {/if}
                {/volist}
            </div>
        </div>
</div>
<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>

<script type="text/javascript">

    $('.delete').click(function(){
        var id = $(this).attr('id');
        layer.confirm('确定要删除?', function(index) {
            $.ajax({
                url:"{:url('admin/admin/adminCateDelete')}",
                data:{id:id},
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            location.href = res.url;
                        },1500)
                    }
                }
            })
        })
    })
</script>
<script type="text/javascript">
    layui.use('layer', function(){
        var layer = layui.layer;
        $('.a_menu').click(function(){
            var url = $(this).attr('href');
            var a = 0;
            $.ajax({
                url:url
                ,async:false
                ,success:function(res){
                    if(res.code == 0) {
                        layer.msg(res.msg);
                        a = 1;
                    }
                }
            })
            if(a === 0) {
                layer.open({
                    type:2,
                    content:url,
                    area: ['500px', '400px'],
                    end:function(){
                        location.reload();
                    }
                });
            }
            return false;
        })

        $('.preview').click(function(){
            var url = $(this).attr('href');
            layer.open({
                type:2,
                content:url,
                area: ['550px', '400px']
            });
            return false;
        })
        $(".seemap").click(function () {
            var id = $(this).attr('codeid');
            $.ajax({
                url:"{:url('admin/poi/seemap')}",
                data:{id:id},
                success:function(res) {
                    if(res.code == 1) {
                        var data=res.data;
                        $("#description").html(data[0].description);
                        $("#poiname").html(data[0].name);
                        var imgs="";
                        for(var i in data[0].thumb){
                            if(data[0].thumb[i]){
                                imgs+='<span class="uploadimgbox"><img class="layui-upload-img" src="'+data[0].thumb[i]+'"></span>';
                            }
                        };
                        $("#thumb").html(imgs);
                        initialize(data[0].lat,data[0].lng);
                    }else{
                        layer.msg(res.msg);
                    }
                }
            })
        })
    });
</script>
    <script type="text/javascript">
        //地图功能
        var geocoder;
        var map2;
        var marker=new google.maps.Marker();
        function initialize(lat,lng) {
            geocoder = new google.maps.Geocoder();
            var myOptions = {
                zoom : 10,//缩放比例
                center:new google.maps.LatLng(lat,lng),
                mapTypeId : google.maps.MapTypeId.ROADMAP
            };
            map2 = new google.maps.Map(document.getElementById("map"),
                myOptions);
            marker.setMap(null);
            marker = new google.maps.Marker({
                map : map2,
                position :new google.maps.LatLng(lat,lng),
                //坐标动画效果
                animation : google.maps.Animation.DROP
            });
            marker.setMap(map2);
        }

        initialize({$latlng[0]},{$latlng[1]});

    </script>
</body>
</html>
